/**
 * Created by web_developer_02 on 2017/11/30
 */
import fetch from '../config/fetch'
import info from './../config/info'
import sendurl from '../config/sendurl'

/**
 * @description 首页请求
 */
export const homeList = (param={}) => fetch('/zzcx/home/home/home-list',param);
export const httpGetTabbar = (param={}) => fetch('/zzcx/home/home/get-bottom',param);
export const getProdByPoi = (param={}) =>fetch('/zzcx/home/home/get-prod-by-poi',param);

export const getProdArr = (param={}) =>fetch('/zzcx/home/bus/get-prod-arr',param);

export const showProdList = (param={}) => fetch('/zzcx/home/home/prod-list',param);

/**
 * 目的地玩乐请求
 * @param param
 * @returns {Promise<*>}
 */
export const endProdList = (param={}) => fetch('/zzcx/home/destination/init',param);
export const endProdTicketList = (param={}) => fetch('/zzcx/home/destination/get-ticket',param);
export const endProdFoodList = (param={}) => fetch('/zzcx/home/destination/get-food',param);
export const endProdItineraryList = (param={}) => fetch('/zzcx/home/destination/get-itinerary',param);

/***
 * 自由行详情
 */
export const freeDetail = (param={}) => fetch('/zzcx/home/free-walker/initialize',param);

/***
 * 自由行订单页
 */
export const getFreeWalkInsure = (param={}) => fetch('/zzcx/home/free-walker/get-free-walk-insure',param);

/**
 * 自由行下单
 */
export const makeOrder = (param={}) => fetch('/zzcx/order/order/make-order',param);

/***
 * 初始化控件数据
 */
export const startGee = (param={}) => fetch('/zzcx/user/login/start-gee',param,'get');
/***
 * 发送验证码
 */
export const sendMsg = (param={}) => fetch('/zzcx/user/login/send-login-msg',param);
/***
 * 登录
 */
export const login = (param={}) => fetch('/zzcx/user/login/do-login',param);
/***
 * 校验是否登录
 */
export const checkLogin = (param={}) => {
    fetch('/zzcx/user/login/check-login',{}).then(res=>{
        if(res.flag===false){
            if(res.code===info.codeNotLogin){
                if(param.unlogin)param.unlogin();
            }
        }else{
            if(param.login)param.login();
        }
    })
};
export const getUserInfo = (param={}) => fetch('/zzcx/user/user/get-user-info',param);
/***
 * 查询热门产品
 */
export const getHotProd = (param={})=>fetch('/zzcx/home/home/get-hot',param);
export const search = (param={})=>fetch('/zzcx/home/home/search',param);

/**
 * 添加评论
 */
export const addCommon = (param={})=>fetch('/zzcx/user/travel/add-travel',param);
/**
 * 评论列表
 */
export const getProdComment = (param={}) => fetch('/zzcx/home/prod/get-prod-comment',param);
/***
 *查看座位
 */
export const watchSeats = (param={}) => fetch('/zzcx/user/travel/watch-seats',param);
/***
 * 获取车位置
 */
export const getBusPosition = (param={}) => fetch('/zzcx/user/travel/get-bus-position',param);

/**
 * 选座座位页面初始化
 */
export const initChooseSeat = (param={}) => fetch('/zzcx/user/travel/init-chose-seat',param);
/**
 * 确认选座
 */
export const chooseSeat = (param={}) => fetch('/zzcx/user/travel/chose-seat',param);

/**
 * 订单详情
 * @param param
 * @returns {Promise<*>}
 */
export const getOrderInfo = (param={}) => fetch('/zzcx/user/order/get-order-info',param);
export const cancelOrder = (param={}) => fetch('/zzcx/user/order/cancel',param);

/**
 * 订单支付
 * @param param
 * @returns {Promise<*>}
 */
export const getPayDate = (param={}) => fetch('/zzcx/order/order/get-pay-date',param);
export const checkOrderStatus = (param={}) => fetch('/zzcx/order/order/check-order-status',param);
/**
 * 酒店订单支付可订检查
 * @param param
 * @returns {Promise<*>}
 */
export const payCheckOrder = (param={}) => fetch('/zzcx/order/order/check-hotel',param);
/**
 * 支付成功
 * @param param
 * @returns {Promise<*>}
 */
export const getRecommend = (param={}) => fetch('/zzcx/order/order/get-recommend',param);

/**
 * 我的行程
 * @param param
 * @returns {Promise<*>}
 */
export const getTravelList = (param={}) => fetch('/zzcx/user/travel/get-travel-list',param);
export const bookTravalMsg = (param={}) => fetch('/zzcx/user/travel/book-travel-msg',param);
export const sendTravelMsg = (param={}) => fetch('/zzcx/user/travel/send-travel-msg',param);

/**
 * 订单列表
 * @param param
 * @returns {Promise<*>}
 */
export const getOrderList = (param={}) => fetch('/zzcx/user/order/get-list',param);

/**
 * 门票订单初始化
 * @param param
 */
export const initialize = (param={}) => fetch('/zzcx/home/men-p/initialize',param);
export const mpGetProdArr = (param={}) => fetch('/zzcx/home/men-p/get-prod-arr',param);

/**
 * 酒店详情
 * @param param
 * @returns {Promise<*>}
 */
export const getHotelDetail = (param={}) => fetch('/zzcx/home/hotel/get-info',param);
/**
 * 酒店房型列表
 * @param param
 * @returns {Promise<*>}
 */
export const getHotelRoomList = (param={}) => fetch('/zzcx/home/hotel/get-room-list',param);
/**
 * 酒店下单
 * @param param
 * @returns {Promise<*>}
 */
export const hotelMakeOrder = (param={}) => fetch('/zzcx/home/hotel/make-order',param);
/**
 * 酒店下单页可定检查
 * @param param
 * @returns {Promise<*>}
 */
export const checkHotel = (param={}) => fetch('/zzcx/home/hotel/check-hotel',param);


export const getHotelType = (param={}) => fetch('/zzcx/home/hotel/get-hotel-type',param);
export const getHotelList = (param={}) => fetch('/zzcx/home/hotel/get-hotel-list',param);

/**
 * 获取酒店所在城市
 * @param param
 * @returns {Promise<*>}
 */
export const getHotelArea = (param={}) => fetch('/zzcx/home/hotel/get-hotel-area',param);

/**
 * 分享接口
 * @param param
 */
export const fenXiang = (param={}) => fetch('/zzcx/user/login/get-fx',param);


/***
 * 司机端登陆码获取
 */
export const driverSendMsg = (param={}) => sendurl('/api/driver-tour-guide/get-code',param);
/***
 * 司机端登陆
 */
export const driverLogin = (param={}) => sendurl('/api/driver-tour-guide/login',param);
/***
 * 任务列表
 */
export const taskList = (param={}) => sendurl('/api/driver-tour-guide/task-list',param);
/***
 * 任务详情
 */
export const taskDetail = (param={}) => sendurl('/api/driver-tour-guide/get-run-info',param);
/***
 * 司机或导游发车
 */
export const runTask = (param={}) => sendurl('/api/driver-tour-guide/run-start',param);
/***
 * 检票
 */
export const checkTickets = (param={}) => sendurl('/api/driver-tour-guide/update-check-status',param);

/***
 * 司机端验证码校验
 */
export const driverStartGee = (param={}) => sendurl('/api/driver-tour-guide/start-gee',param,'get');
